﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/DefaultTemplate.Master" Inherits="System.Web.Mvc.ViewPage<ContactCenter.UI.Web.Models.CustomerDTO>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Edit
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Edit</h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Fields</legend>
            
<%--            <div class="editor-label">
                <%: Html.LabelFor(model => model.Id) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Id) %>
                <%: Html.ValidationMessageFor(model => model.Id) %>
            </div>--%>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.CustomerName) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.CustomerName) %>
                <%: Html.ValidationMessageFor(model => model.CustomerName) %>
            </div>

            <div class="editor-label">
                <%: Html.LabelFor(model => model.ContactInfo.HomePhoneNumber) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.ContactInfo.HomePhoneNumber)%>
                <%: Html.ValidationMessageFor(model => model.ContactInfo.HomePhoneNumber)%>
            </div>

            <div class="editor-label">
                <%: Html.LabelFor(model => model.ContactInfo.MobilePhoneNumber) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.ContactInfo.MobilePhoneNumber)%>
                <%: Html.ValidationMessageFor(model => model.ContactInfo.MobilePhoneNumber)%>
            </div>        
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.ContactInfo.WorkPhoneNumber) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.ContactInfo.WorkPhoneNumber)%>
                <%: Html.ValidationMessageFor(model => model.ContactInfo.WorkPhoneNumber)%>
            </div>               

            <div class="editor-label">
                <%: Html.LabelFor(model => model.ContactInfo.EMail) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.ContactInfo.EMail) %>
                <%: Html.ValidationMessageFor(model => model.ContactInfo.EMail)%>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.CreditCard) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.CreditCard.PublicPart)%> - <%: Html.TextBoxFor(model => model.CreditCard.PrivatePart)%>
                Expiration Date: <%: Html.TextBoxFor(model => model.CreditCard.ExpirationDate, String.Format("{0:MM/yyyy}", Model.CreditCard.ExpirationDate))%>
                <%: Html.ValidationMessageFor(model => model.CreditCard)%>
            </div>                          

        </fieldset>

        <fieldset>
            <legend>Addresses</legend>

            <table>
                <tr>
                    <th>Action</th>
                    <th>Street</th>
                    <th>Postal Code</th>
                    <th>City</th>
                    <th>Region</th>
                </tr>
                <% foreach (var address in this.Model.Addresses)
                {%>
                <tr>
                    <td>
                        <%: Html.ActionLink("Edit", "EditAddress", new { id=address.AddressId }) %>
                    </td>
                    <td><%: address.Street %></td>
                    <td><%: address.PostalCode %></td>
                    <td><%: address.City %></td>
                    <td><%: address.Region %></td>                    
                </tr>
                <%} %>
            </table>

        </fieldset>

        <p>
            <input type="submit" value="Save" />
        </p>

    <% } %>

    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>

